1. Field of the Invention
The present invention relates to digital processors, and more particularly, the present invention relates to a system and method for transferring digital processor internal state data, called context, to and from system memory.
2. Related Art
Digital processors, like general purpose microprocessors as well as custom processors, have internal memories and registers which are used extensively during the processing of any kind of task. The content of these registers at any given instant can be interpreted as the current state of the processor.
In a book titled, VLSI RISC Architecture and Organization, (Marcel Dekker, Inc., 1989), Stephen B. Furber discusses the development of multitasking computers. The following includes a summary of his discussion.
Until recently computers have been expensive, and the pressure to make best use of their capabilities has been intense. Running only one program at a time is inefficient. This is because that program may only require a small fraction of the available memory, and the central processing unit (CPU) is idle for long periods while it waits for information from a disk. If there are two programs resident, the CPU can work on one until a disk transfer is required, then switch to the other while the transfer takes place, and then switch back to the first after the transfer is complete. The CPU is thereby better utilized. In practice, several programs are kept active at any time, and the CPU switches between them according to the availability of data, task priority, etc. This is commonly referred to as "multitasking."
With the advent of the low-cost, moderately powered personal computer (PC) and workstation, multitasking is becoming more commonplace. Rather than loading one machine with tasks from multiple users, a single PC or workstation is often dedicated to perform the multiple tasks of a single user. In this environment, the machine waits until its services are required by the single user. The machine must respond as quickly as possible when called to do something, so as not to keep its user idle.
Multitasking is becoming more popular because the PC is becoming involved in more aspects of its operator's business, and the operator is requiring the PC to perform multiple tasks simultaneously. For example, the operator may like to have multiple documents and spreadsheets visible at the same time, while the machine handles electronic mail in the background, and continues to print the latest report. A multitasking operating system provides the best framework for the implementation of this level of functionality.
As noted, multitasking systems allow several tasks to be processed "simultaneously" by the same processor. In reality, multitasking control software manages the time spent by the processor on each task. The multitasking control software (sometimes called "system software"), interrupts the execution of a current task to allow a new task to be processed, a previous task to complete, or to resume processing. The contents of the processor internal registers describing its current state for the current task are saved in memory by what is called a context save operation. The processor register contents are replaced by the state of the new task to be processed by executing a context restore operation. Resuming the execution of a task is preceded by restoring the state the processor was in prior to the interruption of that task. The system memory, typically external memory, is usually managed by a virtual memory manager.
Thus, multitasking requires two things. First, for flexibility, it must allow a task to be loaded in different parts of system memory, for example, at different times. A processor with a fixed set of tasks loaded at fixed addresses is very inflexible. Second, it must allow tasks to be written without their knowing the amount of memory they will be allocated. The latter condition is most easily satisfied by conventional virtual memory techniques; the former may be satisfied by address translation mechanisms used to implement virtual memory. Using conventional techniques, each task is constructed as though it owned the entire virtual address space, then the address is extended to include a task identifier for translation purposes.
Like virtual memory, support for multitasking is now mandatory on general-purpose computers above the PC level, and it is becoming important on PCs as their processing power approaches that of workstations. Even more advanced reduced instruction set computing (RISC) processors must therefore offer the necessary support if RISC machines are to compete in these market places. This results in additional complexity inside the processor.
These additional complexities and the increased switching due to multitasking brings about the need for an operating system with support for lightweight processes. Thus, the speed of processor context switches becomes more important. In a multitasking graphics processor, for example, conventional context switching systems are much too slow to keep up with the many simultaneous, robust numerical tasks inherent in graphics processing. Therefore, what is desired is a automatic hardware context switching mechanism that can achieve the necessary context switching speed, and thus keep up with multitasking applications.